import { Component, OnInit, Inject, ChangeDetectionStrategy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';

@Component({
  selector: 'task-invite',
  templateUrl: './invite.component.html',
  styleUrls: ['./invite.component.scss'],
  // 对于笨组件 所有的状态改变都是来自于输入属性 值边他才会变
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class InviteComponent implements OnInit {
  items = [
    { id: 1, name: '龙松' },
    { id: 2, name: '杨文' },
    { id: 3, name: '张建' }
  ];
  constructor(@Inject(MAT_DIALOG_DATA) private data, private dialogRef: MatDialogRef<InviteComponent>) { }

  ngOnInit() {
  }
  displayUser(user: { id: string; name: string }) {
    return user ? user.name : null;
  }
  onClick() {
    this.dialogRef.close();
  }
}
